home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
X User Tools
/
X User Tools (O'Reilly and Associates)(1994).ISO
/
sun4c
/
archive
/
tcltk.z
/
tcltk
/
man
/
catn
/
file.n
< prev
next >
Wrap
Text File
|
1994-09-20
|
6KB
|
199 lines
file(n) Tcl Built-In Commands
_________________________________________________________________
NAME
file - Manipulate file names and attributes
SYNOPSIS
file _o_p_t_i_o_n _n_a_m_e ?_a_r_g _a_r_g ...?
_________________________________________________________________
DESCRIPTION
This command provides several operations on a file's name or
attributes. _N_a_m_e is the name of a file; if it starts with a
tilde, then tilde substitution is done before executing the
command (see the manual entry for Tcl_TildeSubst for
details). _O_p_t_i_o_n indicates what to do with the file name.
Any unique abbreviation for _o_p_t_i_o_n is acceptable. The valid
options are:
file atime _n_a_m_e
Returns a decimal string giving the time at which file
_n_a_m_e was last accessed. The time is measured in the
standard POSIX fashion as seconds from a fixed starting
time (often January 1, 1970). If the file doesn't
exist or its access time cannot be queried then an
error is generated.
file dirname _n_a_m_e
Returns all of the characters in _n_a_m_e up to but not
including the last slash character. If there are no
slashes in _n_a_m_e then returns ``.''. If the last slash
in _n_a_m_e is its first character, then return ``/''.
file executable _n_a_m_e
Returns 1 if file _n_a_m_e is executable by the current
user, 0 otherwise.
file exists _n_a_m_e
Returns 1 if file _n_a_m_e exists and the current user has
search privileges for the directories leading to it, 0
otherwise.
file extension _n_a_m_e
Returns all of the characters in _n_a_m_e after and includ-
ing the last dot in _n_a_m_e. If there is no dot in _n_a_m_e
then returns the empty string.
file isdirectory _n_a_m_e
Returns 1 if file _n_a_m_e is a directory, 0 otherwise.
file isfile _n_a_m_e
Returns 1 if file _n_a_m_e is a regular file, 0 otherwise.
Tcl 1
file(n) Tcl Built-In Commands
file lstat _n_a_m_e _v_a_r_N_a_m_e
Same as stat option (see below) except uses the _l_s_t_a_t
kernel call instead of _s_t_a_t. This means that if _n_a_m_e
refers to a symbolic link the information returned in
_v_a_r_N_a_m_e is for the link rather than the file it refers
to. On systems that don't support symbolic links this
option behaves exactly the same as the stat option.
file mtime _n_a_m_e
Returns a decimal string giving the time at which file
_n_a_m_e was last modified. The time is measured in the
standard POSIX fashion as seconds from a fixed starting
time (often January 1, 1970). If the file doesn't
exist or its modified time cannot be queried then an
error is generated.
file owned _n_a_m_e
Returns 1 if file _n_a_m_e is owned by the current user, 0
otherwise.
file readable _n_a_m_e
Returns 1 if file _n_a_m_e is readable by the current user,
0 otherwise.
file readlink _n_a_m_e
Returns the value of the symbolic link given by _n_a_m_e
(i.e. the name of the file it points to). If _n_a_m_e
isn't a symbolic link or its value cannot be read, then
an error is returned. On systems that don't support
symbolic links this option is undefined.
file rootname _n_a_m_e
Returns all of the characters in _n_a_m_e up to but not
including the last ``.'' character in the name. If
_n_a_m_e doesn't contain a dot, then returns _n_a_m_e.
file size _n_a_m_e
Returns a decimal string giving the size of file _n_a_m_e
in bytes. If the file doesn't exist or its size cannot
be queried then an error is generated.
file stat _n_a_m_e _v_a_r_N_a_m_e
Invokes the stat kernel call on _n_a_m_e, and uses the
variable given by _v_a_r_N_a_m_e to hold information returned
from the kernel call. _V_a_r_N_a_m_e is treated as an array
variable, and the following elements of that variable
are set: atime, ctime, dev, gid, ino, mode, mtime,
nlink, size, type, uid. Each element except type is a
decimal string with the value of the corresponding
field from the stat return structure; see the manual
entry for stat for details on the meanings of the
values. The type element gives the type of the file in
Tcl 2
file(n) Tcl Built-In Commands
the same form returned by the command file type. This
command returns an empty string.
file tail _n_a_m_e
Returns all of the characters in _n_a_m_e after the last
slash. If _n_a_m_e contains no slashes then returns _n_a_m_e.
file type _n_a_m_e
Returns a string giving the type of file _n_a_m_e, which
will be one of file, directory, characterSpecial,
blockSpecial, fifo, link, or socket.
file writable _n_a_m_e
Returns 1 if file _n_a_m_e is writable by the current user,
0 otherwise.
KEYWORDS
attributes, directory, file, name, stat
Tcl 3